package org.ly.uap.client.jaas;

import java.security.Principal;

public final class TicketCredential
        implements Principal {
    private static final int HASHCODE_SEED = 17;
    private String ticket;

    public TicketCredential(String ticket) {
        this.ticket = ticket;
    }

    public String getName() {
        return this.ticket;
    }

    public String toString() {
        return this.ticket;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if ((o == null) || (getClass() != o.getClass())) return false;

        TicketCredential that = (TicketCredential) o;

        return this.ticket != null ? this.ticket.equals(that.ticket) : that.ticket == null;
    }

    public int hashCode() {
        int hash = 17;
        hash = hash * 31 + (this.ticket == null ? 0 : this.ticket.hashCode());
        return hash;
    }
}
